package site.teamo.biu.flink.web.configuration.user;

import cn.hutool.cache.Cache;
import cn.hutool.cache.CacheUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author haocongshun
 * @date 2023/10/30 11:09:38
 */
@Configuration
public class UserConfiguration implements WebMvcConfigurer {

    public static final String TOKEN_HEADER_NAME = "Access-Token";
    public static final String USERNAME_ATTRIBUTE_NAME = "Current-Username";

    @Bean
    public Cache<String, String> session() {
//        return CacheUtil.newTimedCache(24 * 3600 * 1000);
        Cache<String, String> cache = CacheUtil.newTimedCache(24 * 3600 * 1000);
        cache.put("biu-flink", "admin");
        return cache;
    }
}
